const accessTokens = {
    admin: "admin-accessToken",
    test: "test-accessToken",
};
export default [{
        url: "/api/login",
        method: "post",
        response: (config) => {
            console.log(config, "config");
            const { username } = config.body;
            const accessToken = accessTokens[username];
            if (!accessToken) {
                return {
                    status: 500,
                    msg: "帐户或密码不正确。",
                };
            }
            return {
                status: 200,
                msg: "success",
                data: { accessToken },
            };
        },
    },
    {
        url: "/api/userInfo",
        type: "get",
        response(config) {
            const { accesstoken } = config.headers;
            let permissions = ["admin"];
            let username = "admin";
            if ("admin-accessToken" === accesstoken) {
                permissions = ["admin"];
                username = "admin";
            }
            if ("test-accessToken" === accesstoken) {
                permissions = ["test"];
                username = "test";
            }
            return {
                status: 200,
                msg: "success",
                data: {
                    permissions,
                    userInfo: {
                        username,
                        avatar: "https://i.gtimg.cn/club/item/face/img/2/15922_100.gif",
                    },
                },
            };
        },
    },
];